package com.techfort.testguice;

import java.util.List;

import roboguice.activity.RoboActivity;
import roboguice.inject.InjectView;
import android.os.Bundle;
import android.widget.ListView;

import com.techfort.testguice.db.FavouriteDAO;
import com.techfort.testguice.pojo.Favourite;

public class Favourites extends RoboActivity {

	private FavouriteDAO fdao;
	@InjectView(R.id.list) ListView list;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list);
		fdao = new FavouriteDAO(this);
		List<Favourite> favs = (List<Favourite>) fdao.getAll();
		ManageItemsAdapter mia = new ManageItemsAdapter(this, R.layout.checkbox_row, 0, favs);
		
		list.setAdapter(mia);
	}
	
	@Override
	protected void onDestroy() {
		try {
			fdao.close();
		} catch(Exception e){
			
		}
		super.onDestroy();
	}
}
